/**
 * 
 */
package me.myachievements.persistence;

import java.util.List;

import org.springframework.transaction.annotation.Transactional;


/**
 * @author besseym
 *
 */
public interface PersistenceManager <T extends PersistentObject> {
	
	/**
	 * Create the given T in the database.
	 * @param t
	 */
	@Transactional
	void create(T t);
	
	/**
	 * Read the T from the database specified by given id and Class.
	 * @param id
	 * @return
	 */
	@Transactional
	T read(Long id);
	
	/**
	 * Update the given T in the database.
	 * @param t
	 */
	@Transactional
	void update(T t);
	
	/**
	 * Delete the given T in the database.
	 * @param t
	 */
	@Transactional
	void delete(T t);
	
	/**
	 * Return all of T in the database.
	 * @return
	 */
	@Transactional
	List<T> findAll(); 
	
	/**
	 * Count all of T in the database.
	 * @return
	 */
	@Transactional
	int countAll();

}
